﻿using System;
using CookComputing.XmlRpc;
//
using PerceptiveMCAPI.Types;
//
namespace PerceptiveMCAPI
{
   internal static class apiException
   {
      internal static Api_Error FormatError( XmlRpcFaultException ex )
      {
         Api_Error err = new Api_Error();
         err.code = ex.FaultCode.ToString(); err.error = ex.FaultString;
         return err;
      }
      internal static Api_Error FormatError( Exception ex )
      {
         Api_Error err = new Api_Error();
         if ( ex.InnerException != null ) ex = ex.InnerException;
         err.code = "ex"; err.error = ex.Message + System.Environment.NewLine + System.Environment.NewLine + ex.StackTrace;
         return err;
      }
   }
}
